package cn.iocoder.yudao.framework.business.order.service;

import cn.iocoder.yudao.framework.business.basic.dao.query.CoreQueryWrapper;
import cn.iocoder.yudao.framework.business.basic.service.impl.MemberScopeService;
import cn.iocoder.yudao.framework.business.order.pojo.dto.OrderQueryDTO;
import cn.iocoder.yudao.framework.business.order.pojo.po.OrderEntity;
import cn.iocoder.yudao.framework.business.order.pojo.vo.BizOrderVO;
import jakarta.annotation.Nonnull;
import lombok.extern.slf4j.Slf4j;

/**
 * 业务订单 Service 实现类，由子类继承
 *
 * @author 山野羡民
 */
@Slf4j
public abstract class AdminOrderBaseService<DO extends OrderEntity, RESP extends BizOrderVO, QUERY extends OrderQueryDTO> extends MemberScopeService<DO, RESP, QUERY> implements AdminOrderService<RESP, QUERY> {

    @Nonnull
    @Override
    protected CoreQueryWrapper<DO> buildQueryWrapper(QUERY param) {
        CoreQueryWrapper<DO> wrapper = super.buildQueryWrapper(param);
        wrapper.eqIfPresent("payed", param.getPayed());
        wrapper.eqIfPresent("trade_no", param.getTradeNo());
        wrapper.eqIfPresent("pay_no", param.getPayNo());
        return wrapper;
    }

}